﻿namespace Distributions.Tests
{
    using Microsoft.VisualStudio.TestTools.UnitTesting;

    using Shared;

    [TestClass]
    public class PoissonDistributionFixture
    {
        [TestMethod]
        public void TestPoisson1()
        {
            const int K = 1;
            const int Delta = 1;

            const double Expected = 0.367879441171442;

            PoissonDistribution poisson = new PoissonDistribution();

            double actual = poisson.NextDouble(K, Delta);

            Assert.AreEqual(Expected, actual);
        }

        [TestMethod]
        public void TestPoisson2()
        {
            const int K = 5;
            const int Delta = 10;

            const double Expected = 0.037833274802071;

            IDistribution poisson = new PoissonDistribution();

            double actual = poisson.NextDouble(K, Delta);

            Assert.AreEqual(Expected, actual);
        }

        [TestMethod]
        public void TestPoisson3()
        {
            const int K = 3;
            const int Delta = 9;

            const double Expected = 0.014994291196532;

            IDistribution poisson = new PoissonDistribution();

            double actual = poisson.NextDouble(K, Delta);

            Assert.AreEqual(Expected, actual);
        }

        [TestMethod]
        public void TestPoisson4()
        {
            const int K = 18;
            const int Delta = 20;

            const double Expected = 0.084393551522481;

            IDistribution poisson = new PoissonDistribution();

            double actual = poisson.NextDouble(K, Delta);

            Assert.AreEqual(Expected, actual);
        }

        // [TestMethod]
        // public void TestMethod1PoissonAccumulative()
        // {
        //    int k = 0;
        //    int delta = 1;
        //    Assert.AreEqual(MathExtension.Function.poissonc(0, delta), 0, 367879441);
        //  }
        // [TestMethod]
        // public void TestMethod2PoissonAccumulative()
        // {
        //    int k = 5;
        //    int delta = 10;
        //    Assert.AreEqual(MathExtension.Function.poissonc(0, delta), 0, 067085963);
        // }
        // [TestMethod]
        // public void TestMethod3PoissonAccumulative()
        // {
        //    int k = 3;
        //    int delta = 9;
        //    Assert.AreEqual(MathExtension.Function.poissonc(0, delta), 0, 021226486);
        // }
        // [TestMethod]
        // public void TestMethod4PoissonAccumulative()
        // {
        //    int k = 18;
        //    int delta = 20;
        //    Assert.AreEqual(MathExtension.Function.poissonc(0, delta), 0, 381421949);
        // }   
    }
}
